@extends('home.inc.common')
@section('title')
    <title>{{$tag->name}}-奇异果聚合</title>
    <meta name="keywords" content="{{$tag->keywords}}" />
    <meta name="description" content="{{$tag->description}}" />
    <link href="{{asset('home_new/css/libs.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/global_tag_recommend.css')}}" rel="stylesheet" type="text/css"/>
    <link href="{{asset('home_new/css/page_tag_recommend.css')}}" rel="stylesheet" type="text/css"/>
    <link href="{{asset('home_new/css/global.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/page2.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/qyg2016.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{asset('home_new/css/page_article.css')}}" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{{asset('home/js/jquery-3.1.0.min.js')}}"></script>
    <style>
        .global_page li{
            float:left;
        }
        .global_page li.active a{
            color: #fff;
            background-color: #2EB872;
        }
    </style>
@endsection
@section('content')
    <div class="wrap">
        <div id="main">
            <div class="plus_wrap" style="padding-top:30px;">
                <div id="main" class="PL_main group_main clear">
                    <div class="group_guide global_guide">
                        <a href="{{url('/')}}">
                            首页
                        </a>
                        &gt;
                        <a href="#">
                            {{$tag->name}}
                        </a>
                    </div>
                    <div class="main_banner">
                        <img src="{{route('image', [trim($tag->background_image, '/'), '1220x215'])}}" class="group_background">
                        <div class="main_bg_pic">
                        </div>
                        <div class="group_message clear" data-groupid="12">
                            <img src="{{route('image', [trim($tag->logo, '/'), '140x140'])}}" class="group_portrait">
                            <h2 class="group_title">
                                {{$tag->name}}
                            </h2>
                            <div class="group_controller clear">
                                <div class="group_nums">
                                    <span class="group_person">视频:</span>
                                    <span>{{$tag->archives()->where('archive_type_id',3)->count()}}</span>
                                    <span class="group_thread">文章:</span>
                                    <span>{{$tag->archives()->where('archive_type_id',1)->count()}}</span>
                                    <span class="group_thread">图集:</span>
                                    <span>{{$tag->archives()->where('archive_type_id',2)->count()}}</span>
                                    <span class="group_thread">累计点击:</span>
                                    <span>20</span>
                                    <div class="video_nbfx tag_recom_nbfx">
                                        @foreach($tag->attributes()->orderBy('sort','asc')->get() as $v)
                                            <span><a href="{!! $v->link !!}" title="{{$tag->name}}-{{ $v->name }}" target="_blank" rel="nofollow"><img src="{{ route('image', [$v->icon, '45x45'])}}"></a></span>
                                        @endforeach
                                    </div>
                                </div>

                            </div>
                        </div>
                        <div class="banner_content clear">
                            <p class="group_description text_short">
                                {!! $tag->content !!}
                            </p>
                        </div>
                        <script type="text/html" id="exit_group_dialog.tpl">
                            < div class = "exit_group_wrap" > <div class = "tipOne" > 您真的要退出该小组吗？ < /div><div class="tipTwo">-听说好看的人都留下了</div > <div class = "tipBtn" > <div class = "noBtn exit_active" > 不退出 < /div><div class="yesBtn">退出</div > </div></div >
                        </script>
                    </div>
                    <div id="content" class="PL_content group_content" data-group_id="12">
                        <div class="content_nav nav_home">
                            <div class="nav_tit">
                                <a href="{{$tag->url}}" class="index_allTab active" data-type="all" @if(empty($type))style="color: #2EB872;"@endif>
                                    全部
                                </a>
                                <a href="{{$tag->url.'/video'}}" class="index_greatTab " data-type="great" @if($type=='video')style="color: #2EB872;"@endif>
                                    视频
                                </a>
                                <a href="{{$tag->url.'/article'}}" class="index_greatTab " data-type="great" @if($type=='article')style="color: #2EB872;"@endif>
                                    文章
                                </a>
                                <a href="{{$tag->url.'/gallery'}}" class="index_greatTab " data-type="great" @if($type=='gallery')style="color: #2EB872;"@endif>
                                    图集
                                </a>
                                @if ( ! $similars->isEmpty())
                                <a href="{{$tag->url.'/similar'}}" class="index_greatTab " data-type="great" @if($type=='similar')style="color: #2EB872;"@endif>
                                    相关标签
                                </a>
                                @endif
                            </div>
                            @if(session('user'))
                                <a href="{{url('member/archives/create/article')}}" target="_blank" rel="nofollow"><div  class="postBtn btn big">
                                        发帖
                                    </div></a>
                            @endif
                        </div>
                        <div class="post_contentWrap" data-page="1" data-tag="group" data-gid="12">
                            <div class="tab_content tab_content_all active">
                                <div class="list_content_wrap" data-totalnum="360">
                                    <div class="post_content_list" data-totalnum="360">
                                        <div class="post_content_list" data-totalnum="360">
                                            @if ($type == 'similar')
                                                <div class="side_groupUser_topic">
                                                    <div class="user_box clear" style="border:none;">
                                                        @foreach($similars as $t)
                                                            <a href="{{ $t->url }}" class="user_img" target="_blank">
                                                                <img src="{{ route('image', [$t->logo, '45x45']) }}" class="pic_size" alt="{{ $t->name }}">
                                                                <span class="group_user_name">{{ $t->name }}</span>
                                                            </a>
                                                        @endforeach
                                                    </div>
                                                </div>
                                            @elseif(isset($archives))
                                                @foreach($archives as $v)
                                                    <div class="list_inner clear">
                                                        @if($v->archive_type_id==4)
                                                            <a href="{{route('article.show', [$v->id])}}" target="_blank" class="inner_left">
                                                                @else
                                                                    <a href="{{route($v->type->name.'.show', [$v->id])}}" target="_blank" class="inner_left">
                                                                        @endif
                                                        <div class="comments">
                                                                评论
                                                            </div>
                                                            <div class="comments comment_nums">
                                                                <span id = "sourceId::{{$v->id}}" class = "cy_cmt_count" ></span>
                                                                <script id="cy_cmt_num" src="http://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cyrlo1kOL">
                                                                </script>
                                                            </div>
                                                        </a>
                                                        <div class="inner_right clear">
                                                            @if($v->archive_type_id==4)
                                                                <a href="{{route('article.show', [$v->id])}}" id="right_title" target="_blank" class="color_black">
                                                                @else
                                                            <a href="{{route($v->type->name.'.show', [$v->id])}}" id="right_title" target="_blank" class="color_black">
                                                                @endif
                                                                {{$v->title}}
                                                            </a>
                                                            <span class="unvisible">
                                                            </span>
                                                            <span class="post_logo plus_zan">
                                                            </span>
                                                            <span class="post_logo plus_hot">
                                                            </span>
                                                            <span class="post_logo plus_great">
                                                            </span>
                                                            <span class="post_logo plus_top">
                                                            </span>
                                                            @if($v->archive_type_id==3)
                                                                <div class="pic_wrap clear">
                                                                    <div class="img_con">
                                                                        <a href="{{route($v->type->name.'.show', [$v->id])}}" class="img_content" target="_blank">
                                                                            <img src="{{route('image', [trim($v->cover, '/'), '120x80'])}}"
                                                                                 alt="{{$v->title}}" title="{{$v->title}}">
                                                                        </a>
                                                                    </div>
                                                                </div>
                                                            @elseif($v->archive_type_id==2)
                                                                <div class="pic_wrap clear">
                                                                    @foreach($v->images()->take(4)->get() as $image)
                                                                        <div class="img_con">
                                                                            <a href="{{route($v->type->name.'.show', [$v->id])}}" class="img_content" target="_blank">
                                                                                <img src="{{route('image', [trim($image->url, '/'), '120x80'])}}"
                                                                                     alt="{{$image->title}}" title="{{$image->title}}">
                                                                            </a>
                                                                        </div>
                                                                    @endforeach
                                                                </div>
                                                            @endif
                                                            <div class="right_tips clear">
                                                                @if($v->archive_type_id==4)
                                                                    <a class="user_name" href="#" target="_blank">
                                                                        {{$v->detail->author}}
                                                                    </a>
                                                                @else
                                                                    <a class="user_name" href="{{ route('author.index', [$v->user->id]) }}" target="_blank">
                                                                        {{$v->user->nickname}}
                                                                    </a>
                                                                @endif

                                                                <div class=" global_user global_user_level level_blue_8 user_level" alt="会员等级">
                                                                </div>
                                                                <span class="post_creatTime global_grey_icons">
                                                                    {{worldTime(strtotime($v->updated_at))}}
                                                                </span>
                                                                <div class="tips_related">
                                                                    <em class="plusGlobalIcons related_comment">
                                                                    </em>
                                                                    {{$v->liked_count}}
                                                                    <em class="related_eyes plusGlobalIcons topic_comment_num">
                                                                    </em>
                                                                    {{$v->visit_count}}
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                @endforeach
                                            @endif
                                        </div>
                                    </div>
                                </div>
                                @if ($type != 'similar')
                                <div class="index_page page_center">
                                    <div class="global_page">
                                        {{$archives->links()}}
                                    </div>
                                </div>
                                @endif
                            </div>
                        </div>
                    </div>
                    <div id="side" class="PL_side group_right group_side" data-type="group" data-group_id="12">
                        @if ( ! $similars->isEmpty())
                        <div class="side_groupUser_topic">
                            <h2>相关标签</h2>
                            @if ($similars->count() > 8)
                            <a href="{{$tag->url.'?type=similar'}}" class="group_icon" rel="nofollow">全部 &gt;</a>
                            @endif
                            <div class="user_box clear">
                                @foreach($similars->slice(0,8) as $t)
                                    <a href="{{ $t->url }}" class="user_img" target="_blank">
                                        <img src="{{ route('image', [$t->logo, '45x45']) }}" class="pic_size" alt="{{ $t->name }}">
                                        <span class="group_user_name">{{ $t->name }}</span>
                                    </a>
                                @endforeach
                            </div>
                        </div>
                        @endif
                        <div class="side_groupRecommend_topic ">
                            <h2>
                                推荐标签
                            </h2>
                            <div class="group_list">
                                @foreach($recommend as $v)
                                    <div class="rec_item  clear">
                                        <div class="group_img">
                                            <a href="{{$v->url}}" target="_blank">
                                                <img src="{{route('image', [trim($v->logo, '/'), '55x55'])}}">
                                            </a>
                                        </div>
                                        <div class="group_info clear">
                                            <div class="rec_title">
                                                <a href="{{$v->url}}" target="_blank">
                                                    {{$v->name}}
                                                </a>
                                                <div class="add_group">
                                                    <a href="{{$v->url}}" target="_blank">
                                                        进入标签&gt;
                                                    </a>
                                                </div>
                                            </div>
                                            <div class="rec_info">
                                                <a href="{{$v->url}}" target="_blank">
                                                        <span class="group_post global_nums ">
                                                            {{$v->archives()->count()}}
                                                        </span>
                                                    <span>
                                                            文档
                                                        </span>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                @endforeach
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection